Prepare Interview

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address

Glassfish Interview Questions and Answers

Question: How to Deploy and Undeploy Applications in Glassfish Command Line?
Answer:
The process of configuring and enabling applications to run within the GlassFish Server
framework is referred to asdeployment.

To Obtain the Sample Application
Download a copy of thehello.warsample application fromhttp://glassfish.java.net/
downloads/quickstart/hello.war.
Save thehello.warfile in the directory of your choice.
This directory is referred to as sample-dir

To Deploy the Sample Application From the Command Line
The sample application must be available before you start this task. To download the sample, see “To Obtain the Sample Application” on page 8. At least one GlassFish Server domain must be started before you deploy the sample application.
Run the asadmin deploy command.
The general form for the command is as follows:
as-install/bin/asadmin deploy war-name
To deploy the hello.war sample, the command is as follows:
as-install/bin/asadmin deploy sample-dir/hello.war
Access thehelloapplication by typing the following URL in your browser:
http://localhost:8080/hello
The application's start page is displayed, and you are prompted to type your name.
Hi, my name is Angel. What’s yours?
Type your name and click Submit.
The application displays a customized response, giving you a personal Hello.

To List Deployed Applications From the Command Line
Run the asadmin list-applications command:
as-install/bin/asadmin list-applications

To Undeploy the Sample Application From the Command Line
Run the asadmin undeploy command.
The general form for the command is as follows:
as-install/bin/asadmin undeploy war-name
Forwar-name, use the literal hello, not the full hello.warname.
For the hello.war example, the command is as follows:
as-install/bin/asadmin undeploy hello
Is it helpful? Yes No

Most helpful rated by users:

©2024 WithoutBook